﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using WebClient;
namespace WebClient.admin.Modules.category
{
    public partial class AddNew : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.btnAddNew.Attributes.Add("onclick", "return OnSubmitClick();");
            this.btnCancel.Attributes.Add("onclick", "return ClearAll()");
        }

        private void AddNewItem()
        {
            WebData data = new WebData();
            Category item = new Category();            
            item.name = this.txtname.Text.Trim();
            item.create_on = DateTime.Now;
            item.orderId = Convert.ToInt32(this.txtorderId.Text.Trim());
            data.OnSubmitCategory(item, 0);
        }
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            AddNewItem();
        }
    }
}